<?php

/**
 * This is the model class for table "t_gajipns".
 *
 * The followings are the available columns in table 't_gajipns':
 * @property string $GOL
 * @property integer $MKGTH
 * @property string $GAPOKLAMA1
 * @property string $GAPOKLAMA2
 * @property string $GAPOK08
 * @property string $GAPOK09
 * @property string $GAPOK10
 * @property string $GAPOK
 * @property integer $ID
 */
class TGajipns extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TGajipns the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 't_gajipns';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{ 
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('MKGTH', 'numerical', 'integerOnly'=>true),
			array('GOL', 'length', 'max'=>2),
			array('GAPOKLAMA1, GAPOKLAMA2, GAPOK08, GAPOK09, GAPOK10, GAPOK', 'length', 'max'=>19),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('GOL, MKGTH, GAPOKLAMA1, GAPOKLAMA2, GAPOK08, GAPOK09, GAPOK10, GAPOK, ID', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'gol_desc' => array(self::BELONGS_TO,'TGol',array('GOL'=>'KDGOL'))
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'GOL' => 'Kode Gol',
			'MKGTH' => 'Mkgth',
			'GAPOKLAMA1' => 'Gapoklama1',
			'GAPOKLAMA2' => 'Gapoklama2',
			'GAPOK08' => 'Gapok08',
			'GAPOK09' => 'Gapok09',
			'GAPOK10' => 'Gapok10',
			'GAPOK' => 'Gapok',
			'ID' => 'ID',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('GOL',$this->GOL,true);
		$criteria->compare('MKGTH',$this->MKGTH);
		$criteria->compare('GAPOKLAMA1',$this->GAPOKLAMA1,true);
		$criteria->compare('GAPOKLAMA2',$this->GAPOKLAMA2,true);
		$criteria->compare('GAPOK08',$this->GAPOK08,true);
		$criteria->compare('GAPOK09',$this->GAPOK09,true);
		$criteria->compare('GAPOK10',$this->GAPOK10,true);
		$criteria->compare('GAPOK',$this->GAPOK,true);
		$criteria->compare('ID',$this->ID);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}